home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Table / Include / TblFrame.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  5.6 KB  |  184 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                TblFrame.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef TBLFRAME_H
  11. #define TBLFRAME_H
  12.  
  13. // ----- TablePart Includes -----
  14.  
  15. #ifndef TBLPART_H
  16. #include "TblPart.h"
  17. #endif
  18.  
  19. // ----- ODF Includes -----
  20.  
  21. #ifndef FWFRMING_H
  22. #include "FWFrming.h"
  23. #endif
  24.  
  25. #ifndef FWPRESEN_H
  26. #include "FWPresen.h"
  27. #endif
  28.  
  29. #ifndef FWRECSHP_H
  30. #include "FWRecShp.h"
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward declarations
  35. //========================================================================================
  36.  
  37. #if FW_LIB_EXPORT_PRAGMAS
  38. #pragma import on
  39. #endif
  40. class FW_CLASS_ATTR FW_CGraphicContext;
  41. #if FW_LIB_EXPORT_PRAGMAS
  42. #pragma import off
  43. #endif
  44.  
  45. class FW_CLASS_ATTR CTablePart;
  46. class FW_CLASS_ATTR CTableSelection;
  47. class FW_CLASS_ATTR CTableProxy;
  48.  
  49. //========================================================================================
  50. //    class CTableFrame
  51. //========================================================================================
  52.  
  53. class FW_CLASS_ATTR CTableFrame : public FW_CEmbeddingFrame
  54. {
  55. //----------------------------------------------------------------------------------------
  56. //    Initialization/Destruction
  57. //
  58. public:
  59.     CTableFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, CTablePart* tablePart);
  60.     virtual ~ CTableFrame();
  61.     
  62. //----------------------------------------------------------------------------------------
  63. //    Inherited API
  64. //
  65. public:
  66.     // ----- Getters/Setters -----
  67.     CTablePart*                GetPart() const;
  68.     CTableSelection*        GetSelection(Environment* ev) const;
  69.     ETableLoc                GetDragLocation() const;
  70.     CCell                    GetDragCell() const;
  71.     CCell                    GetDragSourceCell() const;
  72.     
  73.     // ----- Focus change -----
  74.     virtual void            FocusStateChanged(Environment* ev, ODTypeToken focus, FW_Boolean newState, ODFrame* newOwner);
  75.  
  76.     // ----- Embedding -----
  77.     virtual void            EmbedSingleFrame(Environment* ev,
  78.                                         ODPart* odEmbeddedPart, 
  79.                                         ODFrame* odEmbeddedFrame, 
  80.                                         ODShape* frameShape);
  81.     
  82.     virtual ODFacet*        CreateEmbeddedFacet(Environment* ev,
  83.                                             ODFacet* embeddingFacet,
  84.                                             FW_MProxy* proxy,
  85.                                             ODFrame* embeddedFrame,
  86.                                             ODShape* proposedClipShape);
  87.     // ----- Rendering -----
  88.     virtual void             Draw(Environment* ev, 
  89.                                         ODFacet* odFacet, 
  90.                                         ODShape* invalidShape);
  91.  
  92.     // ----- Menus -----
  93.     virtual FW_Boolean        DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot);
  94.     virtual FW_Boolean        DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent);
  95.  
  96.     // ----- Events -----
  97.     virtual FW_Boolean        DoCharKey(Environment* ev, const FW_CCharKeyEvent& theCharKeyEvent);
  98.     virtual FW_Boolean        DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent);
  99.     virtual FW_Boolean        DoMouseDownInEmbeddedFrameBorder(Environment* ev, const FW_CBorderMouseEvent& theBorderMouseEvent);
  100.     
  101.     // ----- Adjust Cursor -----
  102.     virtual FW_Boolean        AdjustCursor(Environment* ev, ODFacet* odFacet, const FW_CPoint& where);
  103.  
  104.     // ----- Geometry -----
  105.     virtual void             FrameShapeChanged(Environment* ev);
  106.  
  107.     // ----- Drag And Drop -----
  108.     virtual FW_CDropTracker* NewDropTracker(Environment *ev, FW_CView* view, ODFacet* facet);
  109.  
  110.     virtual FW_CDragCommand* NewDragCommand(Environment *ev, FW_CFrame* theFrame);
  111.     virtual FW_CDropCommand* NewDropCommand(Environment *ev,
  112.                                             FW_CFrame* frame,
  113.                                             ODDragItemIterator* dropInfo, 
  114.                                             ODFacet* odFacet, 
  115.                                             const FW_CPoint& dropPoint);
  116.  
  117.     virtual FW_CEditCommand* NewEditCommand(Environment* ev, ODCommandID commandID);
  118.  
  119.     virtual FW_Boolean        Drag(Environment* ev, const FW_CMouseEvent& event);
  120.  
  121.     // ----- Linking -----
  122.     virtual void            FacetAdded(Environment* ev, ODFacet* facet);
  123.     virtual void            ShowPartInfo(Environment* ev);
  124.     virtual FW_Boolean        RevealFrame(Environment *ev, 
  125.                                         ODFrame* embeddedFrame, 
  126.                                         ODShape* revealShape);
  127.  
  128. //----------------------------------------------------------------------------------------
  129. //    New API
  130. //
  131. public:
  132.     void            DrawGrid(Environment* ev, FW_CGraphicContext& gc, FW_Boolean gray);
  133.     void            HideShowGrid(Environment* ev);
  134.  
  135.     FW_Boolean        IsGridShown(Environment* ev) const
  136.                         {return fGridShown;}
  137.                         
  138.     void            GetRect(Environment* ev, FW_CRect& rect) const;
  139.  
  140.     void            DrawSelectBorder(Environment* ev, FW_CFacetContext& fc, 
  141.                                     const CCell& cell);
  142.  
  143.     void            MoveProxy(Environment* ev, CTableProxy* proxy, const CCell& destCell);
  144.  
  145.     // ----- Mouse down response -----
  146.     FW_Boolean        Resize(Environment* ev, 
  147.                            const FW_CMouseEvent& theMouseEvent,
  148.                            const CCell& cell,
  149.                            ETableLoc tl);
  150.  
  151.     void            SelectCell(Environment* ev, const CCell& cell, FW_Boolean drawNow);
  152.  
  153.     // ----- Linking -----
  154.     void            DrawLinkBorder(Environment* ev, 
  155.                                    const CCell& cell, 
  156.                                    FW_CFacetContext& fc,
  157.                                    FW_Boolean isSourceLink);
  158.  
  159. //----------------------------------------------------------------------------------------
  160. //    Data Members
  161. //
  162. protected:
  163.     // ----- Part back-pointer -----
  164.     CTablePart*        fTablePart;
  165.     
  166.     // ----- Drag & drop state variables -----
  167.     CCell        fDraggedCell;
  168.     
  169.     FW_Boolean        fGridShown;
  170.     
  171.     FW_CRectShape    fSelectFrame;
  172. };
  173.  
  174.  
  175. //----------------------------------------------------------------------------------------
  176. //    CTableFrame::GetPart
  177. //----------------------------------------------------------------------------------------
  178. inline CTablePart* CTableFrame::GetPart() const
  179. {
  180.     return fTablePart;
  181. }
  182.  
  183. #endif
  184.